const { v4: uuidv4 } = require('uuid');
// const moment = require('moment');

/**
 * 表单模型
 */
module.exports = (app) => {
  const { STRING, INTEGER, TEXT,UUID } = app.Sequelize;
  const Account = app.model.define(
    "account",
    {
      id: {
        type: UUID,
        unique: true,
        primaryKey: true,
        allowNull: false,
        defaultValue: () => {
          return uuidv4()
            .replace(/-/g, '');
        }
      },
      accountNumber: {
        type: STRING,
        allowNull: false,
      },
      passWord: {
        type: INTEGER,
        allowNull: false,
      },
      disabled: {
        type: INTEGER,
        allowNull: false,
        defaultValue: 0,
      },
      delFlag: {
        type: INTEGER,
        allowNull: false,
        defaultValue: 0,
      },
    },
    {
      timestamps: false,
    }
  );

  return Account;
};
